<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
if(!defined("QINIU_FUNCTIONS_VERSION")) {
    define("QINIU_FUNCTIONS_VERSION", Qiniu\Config::SDK_VER);
    function crc32_file($file)
    {
        $hash = hash_file("crc32b", $file);
        $array = unpack("N", pack("H*", $hash));
        return sprintf("%u", $array[1]);
    }
    function crc32_data($data)
    {
        $hash = Qiniu\hash("crc32b", $data);
        $array = unpack("N", pack("H*", $hash));
        return sprintf("%u", $array[1]);
    }
    function base64_urlSafeEncode($data)
    {
        $find = ["+", "/"];
        $replace = ["-", "_"];
        return str_replace($find, $replace, base64_encode($data));
    }
    function base64_urlSafeDecode($str)
    {
        $find = ["-", "_"];
        $replace = ["+", "/"];
        return base64_decode(str_replace($find, $replace, $str));
    }
    function json_decode($json, $assoc = false, $depth = 512)
    {
        if(empty($json)) {
            return NULL;
        }
        $data = json_decode($json, $assoc, $depth);
        if(JSON_ERROR_NONE !== Qiniu\json_last_error()) {
            $last = Qiniu\json_last_error();
            throw new InvalidArgumentException("Unable to parse JSON data: " . (isset($jsonErrors[$last]) ? $jsonErrors[$last] : "Unknown error"));
        }
        return $data;
    }
    function entry($bucket, $key)
    {
        $en = $bucket;
        if(!empty($key)) {
            $en = $bucket . ":" . $key;
        }
        return Qiniu\base64_urlSafeEncode($en);
    }
    function setWithoutEmpty(&$array, $key, $value)
    {
        if(!empty($value)) {
            $array[$key] = $value;
        }
        return $array;
    }
    function thumbnail($url, $mode, $width, $height, $format = NULL, $quality = NULL, $interlace = NULL, $ignoreError = 1)
    {
        if(is_null($imageUrlBuilder)) {
            $imageUrlBuilder = new Qiniu\Processing\ImageUrlBuilder();
        }
        return call_user_func_array([$imageUrlBuilder, "thumbnail"], func_get_args());
    }
    function waterImg($url, $image, $dissolve = 100, $gravity = "SouthEast", $dx = NULL, $dy = NULL, $watermarkScale = NULL)
    {
        if(is_null($imageUrlBuilder)) {
            $imageUrlBuilder = new Qiniu\Processing\ImageUrlBuilder();
        }
        return call_user_func_array([$imageUrlBuilder, "waterImg"], func_get_args());
    }
    function waterText($url, $text, $font = "黑体", $fontSize = 0, $fontColor = NULL, $dissolve = 100, $gravity = "SouthEast", $dx = NULL, $dy = NULL)
    {
        if(is_null($imageUrlBuilder)) {
            $imageUrlBuilder = new Qiniu\Processing\ImageUrlBuilder();
        }
        return call_user_func_array([$imageUrlBuilder, "waterText"], func_get_args());
    }
    function explodeUpToken($upToken)
    {
        $items = explode(":", $upToken);
        if(count($items) != 3) {
            return [NULL, NULL, "invalid uptoken"];
        }
        $accessKey = $items[0];
        $putPolicy = json_decode(Qiniu\base64_urlSafeDecode($items[2]));
        $scope = $putPolicy->scope;
        $scopeItems = explode(":", $scope);
        $bucket = $scopeItems[0];
        return [$accessKey, $bucket, NULL];
    }
}

?>